package tedu.api.exception;

public class ThrowsDemo {
    public static void main(String[] args) {
        /*

        3.一般不在main方法中做throws抛出
         */

        Student zs = new Student();
        try {
            zs.setAge(1000);
        } catch (IllegalAgeException e) {
            e.printStackTrace();//打印错误堆栈信息
            //System.out.println(e.getMessage());//获取错误信息并输出
        }
        System.out.println("此人年龄为"+zs.getAge());


    }
}

















